package com.you.base.callback;

public class CallBackMethod {

    public static void main(String[] args) {

        CallBackMethod callBackMethod = new CallBackMethod();

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(3000L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                String result = "这是线程执行完的结果!";
                callBackMethod.callbackEMethod(result);
            }
        });
        t1.start();
    }

    public void callbackEMethod(Object result) {
        String resultStr = null;
        if (result instanceof String) {
            resultStr = (String) result;
        }
        System.out.println("---------t1 thread is end , call back method run ,get result is: " + result);
    }

}
